<template>
	<div>
		<div>
			<MkCard>
				<!-- <MkButtonAdd size="large" @click="handleAdd" /> -->
				<BaseSearchForm v-model:search-param="ctx.searchParam" @goBack="emit('goto-edit')" @search="search" @add="handleAdd" :isShowBack="false" :isShowHistoryTitle="false" :isShowAdd="true" />
			</MkCard>
			<MkCard>
				<MkTable height="600px" :data="filteredList" @row-dblclick="rowDbClick">
					<el-table-column label="ID" prop="id" />
					<el-table-column label="检验名称" prop="name" />
					<el-table-column label="项目代码" prop="projectCode" />
					<el-table-column label="检验代码" prop="textCode" />
					<el-table-column label="参考范围" prop="referenceRange" />
					<el-table-column label="合法上限公式" prop="upperLimit" />
					<el-table-column label="合法下限公式" prop="lowerLimit" />
					<el-table-column label="爆红公式" prop="explosivePopularity" />
					<el-table-column label="单位" prop="unit" />
					<el-table-column label="xoc判断" prop="xoc" />
					<el-table-column label="sco自动审核公式" prop="sco" />
					<el-table-column label="默认值" prop="defaultValue" />
					<el-table-column label="枚举Type" prop="enumType" />
					<el-table-column label="仪器任务" prop="instrumentTask" />
					<el-table-column label="备注" prop="remark" />
					<MkColumnIsEnabled prop="isEnabled" />
				</MkTable>
			</MkCard>
		</div>

		<edit ref="editRef" @returnData="updata" />
	</div>
</template>
<script lang="ts" setup>
import edit from './edit.vue';
import { ref, onMounted } from 'vue';
import { initialize } from './index';
const editRef = ref();
// 用于存储过滤后的结果
const filteredList = ref();
//假数据
const list = ref([
	{
		id: 1,
		name: '张三',
		projectCode: '01',
		textCode: '02',
		referenceRange: '15-20',
		upperLimit: '20',
		lowerLimit: '15',
		explosivePopularity: 'a*b > a',
		unit: '广州市检验科',
		xoc: '符合',
		sco: '公式1',
		defaultValue: '默认值1',
		enumType: 'type1',
		instrumentTask: '任务1',
		remark: '备注1',
		isEnabled: false,
	},
	{
		id: 2,
		name: '李四',
		projectCode: '03',
		textCode: '04',
		referenceRange: '15-20',
		upperLimit: '20',
		lowerLimit: '15',
		explosivePopularity: 'a*b > a',
		unit: '广州市检验科',
		xoc: '符合',
		sco: '公式1',
		defaultValue: '默认值1',
		enumType: 'type1',
		instrumentTask: '任务2',
		remark: '备注1',
		isEnabled: false,
	},
	{
		id: 3,
		name: '王五',
		projectCode: '05',
		textCode: '01',
		referenceRange: '15-20',
		upperLimit: '20',
		lowerLimit: '15',
		explosivePopularity: 'a*b > a',
		unit: '广州市检验科',
		xoc: '符合',
		sco: '公式1',
		defaultValue: '默认值1',
		enumType: 'type1',
		instrumentTask: '任务3',
		remark: '备注1',
		isEnabled: true,
	},
]);
const { ctx, handleAdd, search, updata, rowDbClick } = initialize(editRef, filteredList, list);

const emit = defineEmits(['goto-edit']);

onMounted(() => {
	search();
});

defineOptions({
	name: 'inpXianMu',
});
</script>
